package cn.yueranzs.utils;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 分页工具类
 * @author yueranzs
 * @date 2021-11-04 11:27
 */
public class PaginationUtil {
    /**
     * 获取分页对象，默认currentPage:1，pageSize：50
     * @param currentPage
     * @param pageSize
     * @return
     */
    public static Page getNewPage(Integer currentPage,Integer pageSize){
        Page page = new Page(1,50);
        if (ObjectUtil.isNotEmpty(currentPage)) {
            page.setCurrent(currentPage);
        }
        if (ObjectUtil.isNotEmpty(pageSize)) {
            page.setSize(pageSize);
        }
        return page;
    }

}
